-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
examples: add blecent and bleprph similar to mynewt-nimble apps #2807
base: master
Are you sure you want to change the base?
Conversation
These example apps create a BLE central and peripheral based on mynewt-nimBLE and work in companion. The apps are mostly based on their equivalents, which can be found at https://github.com/apache/mynewt-nimble/tree/master/apps
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @maxikrie :-) Please fix the code formatting issues: https://github.com/apache/nuttx-apps/actions/runs/11602988992/job/32309359887?pr=2807 :-)
void | ||
print_bytes(const uint8_t *bytes, int len) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maxikrie I think it can fit in a single line
} | ||
|
||
void | ||
print_mbuf(const struct os_mbuf *om) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
while (om != NULL) { | ||
if (colon) { | ||
printf(":"); | ||
} else { | ||
colon = 1; | ||
} | ||
print_bytes(om->om_data, om->om_len); | ||
om = SLIST_NEXT(om, om_next); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run the nxstyle or checkpatch.sh, it doesn't adhere to coding style, more info:
https://nuttx.apache.org/docs/latest/contributing/index.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will make changes and adhere to the standard. I am sorry that I didn't follow it immediately, it has been a while since my last pull request and I didn't see the documentation on contributing beforehand.
} | ||
|
||
char * | ||
addr_str(const void *addr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
} | ||
|
||
void | ||
print_uuid(const ble_uuid_t *uuid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
why not modify the current nimble peripheral example (https://github.com/apache/nuttx-apps/blob/master/examples/nimble/nimble_main.c)? do we need 2 different examples for this? |
I was debating this with myself. As stated, I based them on the mynewt-nimble apps and hence the peripheral is quite different from the existing one. I could, of course, modify the existing one losing the tight connection to the mynewt-nimble app. The other options are maintaining the existing one along side my contribution for legacy reasons, or purging the existing one (my preference). What do you think? @raiden00pl |
@maxikrie The Mynewt coding standard is far from the NuttX coding standard, so the code will be a lot different anyway. Keeping 2 examples demonstrating the same functionality seems pointless to me. The easiest thing to do would be to change the name of existing |
# see the file kconfig-language.txt in the NuttX tools repository. | ||
# | ||
|
||
config EXAMPLES_NIMBLE_BLECENT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about using the names nimble_cent
and nimble_prph
?
CI checkpatch is now fixed, CI restarted :-) |
Source code still needs reformat, @maxikrie please take a look at: |
Summary
These example apps create a BLE central and peripheral based on mynewt-nimBLE and work in companion. The apps are mostly based on their equivalents, which can be found at https://github.com/apache/mynewt-nimble/tree/master/apps
Impact
Testing
These were successfully tested on two nrf52840-dk boards.